<?php
namespace Admin\Controller;
use Think\Controller;
class SanController extends Controller{
	public function form(){
		$city = M('city');
		$show = $city->where('city_pid=0')->select();
		$this->assign('show',$show);
		$this->display();
	}
	//三级联动
	function getCate(){
		$id = I('get.city_id');
		$city_mode = M('city');
		//根据当前id来寻找pid
		$city_list = $city_mode->where("city_pid=$id")->select();
		$result = '';
		//组合要返回的数据
		foreach($city_list as $value){
			$result .= "<option value='{$value['city_id']}'>{$value['city_name']}</option>";
		}
		echo ($result);
	}
}